const { toUrl } = getApp()
import { request } from "@/utils/request"
Component({
    properties: {
    },

    
    data: {
        activeList: [],
        count: 1,
        page: 1,
        sort: 0,
        activeForm: {
            typeid: 0,
            page: 1
        },
        activeCount: 1
    },

    methods: {
        toUrl,
        getList() {
            if(this.data.page > this.data.count) {
                // this.setData({
                //     isExit: false
                // })
                this.triggerEvent('listenBottom', false)
                return
            }
            const that = this
            const data = {
                sort: this.data.sort,
                page: this.data.page,
            }
            request('activity/activitylist',{data}).then(res => {
                that.setData({
                    activeList: that.data.activeList.concat(res.data),
                    activeCount: res.count,
                    page: ++that.data.activeForm.page
                })
            })
        },
        getMyActiveList() {
            if(this.data.page > this.data.count) {
                this.triggerEvent('listenMyBottom', false)
                return
            }
            const that = this
            const data = {
                typeid: this.data.activeForm.typeid,
                page: this.data.activeForm.page
            }
            request('activity/myactivitylist',{data}).then(res => {
                that.setData({
                    activeList: that.data.activeList.concat(res.data),
                    count: res.count,
                    page: ++that.data.page
                })
            })
        }
    }
})
